package com.concurrency.example.threadLocal;

/**
 * 用ThreadLocal保存每个请求的信息
 */
public class RequestHolder {
    private final static ThreadLocal<Long> requestHolder = new ThreadLocal<>();

    public static void add(Long id){
        requestHolder.set(id);
    }

    public static Long get(){
        return requestHolder.get();
    }
    public static void remove(){
        requestHolder.remove();
    }
}

